package com.ternnetwork.core.access.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ternnetwork.commons.model.http.BaseResponse;
import com.ternnetwork.core.accesscontroll.enums.ResourcesType;
import com.ternnetwork.core.accesscontroll.service.RescRoleService;

@Controller
@RequestMapping("/access/resc-role/*")
public class RescRoleController {
	
	@Autowired
	private RescRoleService  rescRoleService;


	@PreAuthorize("hasAnyAuthority('ACCESS_RESOURCES_ROLE_UPDATE')")
	@RequestMapping("/update")
	//清空用户菜单缓存
	@CacheEvict(value="userMenu", allEntries=true)
    public @ResponseBody BaseResponse update(ResourcesType  resourcesType,Long roleId,String resourcesIds) {
   	    return rescRoleService.update(roleId, resourcesType, resourcesIds);
    }
	 
	

}
